package a.f.d;

import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.k;
import a.c.m;
import a.c.n;
import a.c.q;
import a.c.v;
import a.c.x;
import a.c.z;
import a.f.o;
import a.f.zb;
import a.i.db;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

public class h
  extends f
{
  private int[] p;
  private int[] q;
  private int[] r;
  private boolean[] s;
  private int[] t;
  private int[] u;
  private double[][] v;
  private double[] w;
  private int[] x;
  private boolean[] y;
  private double[] z;
  private double[] A;
  private double[] B;
  private double[] C;
  public static int D;
  
  protected void a(bb[] paramArrayOfbb, k paramk)
  {
    o localo = this.l;
    a(localo, paramArrayOfbb);
    a(localo, paramArrayOfbb);
    a(paramArrayOfbb, db.b(this.s), this.j, this.p);
    a(localo, this.v[0]);
    b(localo, paramArrayOfbb);
    a(localo, this.v[0], paramArrayOfbb);
    b(paramArrayOfbb);
    a(localo, this.v[1]);
    b(localo, paramArrayOfbb);
    a(localo, this.v[1], paramArrayOfbb);
    b(paramArrayOfbb);
    a(this.v[1]);
    d(paramArrayOfbb);
    a(localo, this.v[2]);
    b(localo, paramArrayOfbb);
    a(localo, this.v[2], paramArrayOfbb);
    b(paramArrayOfbb);
    a(localo, this.v[3]);
    b(localo, paramArrayOfbb);
    a(localo, this.v[3], paramArrayOfbb);
    b(paramArrayOfbb);
    a(this.v[3]);
    d(paramArrayOfbb);
    a(localo);
  }
  
  void a(double[] paramArrayOfDouble)
  {
    int k = f.o;
    int j = f.n;
    do
    {
      for (int i = 0; j == 0; i++)
      {
        if (i >= paramArrayOfDouble.length) {
          break;
        }
        paramArrayOfDouble[i] = (-paramArrayOfDouble[i]);
      }
    } while (k != 0);
  }
  
  void b(bb[] paramArrayOfbb)
  {
    int i1 = f.o;
    int n = f.n;
    int i = 0;
    do
    {
      do
      {
        if (i >= paramArrayOfbb.length) {
          break;
        }
        bb localbb = paramArrayOfbb[i];
        localbb.j();
        i++;
        if (i1 != 0) {
          break label52;
        }
        if (n != 0) {
          break label51;
        }
      } while (n == 0);
    } while (i1 != 0);
    i = 0;
    label51:
    label52:
    Object localObject1;
    Object localObject2;
    label291:
    label293:
    label376:
    label378:
    label381:
    do
    {
      if (i >= paramArrayOfbb.length) {
        break;
      }
      int j = 0;
      localObject1 = null;
      localObject2 = paramArrayOfbb[i].l();
      do
      {
        do
        {
          do
          {
            if (!((a.c.w)localObject2).e()) {
              break label381;
            }
            e locale = ((a.c.w)localObject2).d();
            int k = locale.f();
            if (i1 == 0)
            {
              this.p[k] = (j++);
              if (n != 0) {
                break label395;
              }
            }
            this.q[k] = ((i1 != 0) || (localObject1 != null) ? ((e)localObject1).f() : -1);
            this.r[k] = -1;
            if (i1 == 0)
            {
              if (localObject1 != null)
              {
                this.r[localObject1.f()] = k;
                this.C[localObject1.f()] = this.C[k];
              }
              localObject1 = locale;
            }
            int m = locale.d();
            d locald2;
            d locald3;
            d locald4;
            if (i1 == 0)
            {
              if (m > 1)
              {
                locald2 = locale.k();
                locald3 = locale.i();
                do
                {
                  if (m <= 1) {
                    break;
                  }
                  locald4 = locald3;
                  locald3 = locald3.j();
                  this.l.a(locald4, locald4.i(), locald2, 1, 0);
                  m--;
                  if (i1 != 0) {
                    break label293;
                  }
                  if (n != 0) {
                    break label291;
                  }
                } while (n == 0);
              }
              if (i1 != 0) {}
            }
            else
            {
              m = locale.e();
            }
            if (m > 1)
            {
              locald2 = locale.j();
              locald3 = locale.h();
              do
              {
                if (m <= 1) {
                  break;
                }
                locald4 = locald3;
                locald3 = locald3.i();
                this.l.a(locald4, locald2, locald4.j(), 0, 1);
                m--;
                if (i1 != 0) {
                  break label378;
                }
                if (n != 0) {
                  break label376;
                }
              } while (n == 0);
            }
          } while (i1 != 0);
          ((a.c.w)localObject2).f();
        } while (n == 0);
        i++;
      } while (i1 != 0);
    } while (n == 0);
    label395:
    m localm = this.l.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald1 = localm.a();
      localObject1 = this.l.p(locald1);
      this.l.a(locald1, new a.d.w(-((a.d.w)localObject1).a(), ((a.d.w)localObject1).b()));
      localObject2 = this.l.q(locald1);
      this.l.b(locald1, new a.d.w(-((a.d.w)localObject2).a(), ((a.d.w)localObject2).b()));
      localm.f();
    } while (n == 0);
  }
  
  void d(bb[] paramArrayOfbb)
  {
    int k = f.o;
    int j = f.n;
    Object localObject1 = this.l.w();
    do
    {
      if (!((m)localObject1).e()) {
        break;
      }
      d locald = ((m)localObject1).a();
      this.l.e(locald);
      localObject2 = this.l.p(locald);
      a.d.w localw = this.l.q(locald);
      this.l.b(locald, (a.d.w)localObject2);
      this.l.a(locald, localw);
      ((m)localObject1).f();
    } while (j == 0);
    localObject1 = new z(paramArrayOfbb);
    do
    {
      for (int i = 0; j == 0; i++)
      {
        if (i >= paramArrayOfbb.length) {
          break;
        }
        paramArrayOfbb[i] = ((bb)((z)localObject1).e());
      }
    } while (k != 0);
    ib localib = new ib(this.p, (byte)6);
    Object localObject2 = new ib(this.p, (byte)5);
    this.l.a(localib, (Comparator)localObject2);
  }
  
  protected void a(q paramq, bb[] paramArrayOfbb)
  {
    int i2 = f.o;
    int i1 = f.n;
    int i = paramq.k();
    int j = paramq.m();
    this.p = new int[i];
    this.q = new int[i];
    this.r = new int[i];
    this.t = new int[i];
    this.u = new int[i];
    this.x = new int[i];
    this.B = new double[i];
    this.C = new double[i];
    this.v = new double[4][i];
    this.w = new double[i];
    this.z = new double[i];
    this.A = new double[i];
    this.y = new boolean[i];
    this.s = new boolean[j];
    int k = 0;
    label308:
    label310:
    do
    {
      if (k >= paramArrayOfbb.length) {
        break;
      }
      int m = 0;
      Object localObject = null;
      a.c.w localw = paramArrayOfbb[k].l();
      do
      {
        if (!localw.e()) {
          break;
        }
        e locale = localw.d();
        int n = locale.f();
        this.p[n] = (m++);
        if (i2 != 0) {
          break label310;
        }
        if (i1 != 0) {
          break label308;
        }
        this.q[n] = ((i2 != 0) || (localObject != null) ? ((e)localObject).f() : -1);
        this.r[n] = -1;
        if (i2 == 0)
        {
          if (localObject != null)
          {
            this.r[localObject.f()] = n;
            this.C[localObject.f()] = o((e)localObject);
          }
          this.B[n] = this.l.s(locale);
        }
        localObject = locale;
        localw.f();
      } while (i1 == 0);
      if (i2 == 0) {
        k++;
      }
    } while (i1 == 0);
    nb.a_ locala_1 = new nb.a_(this.p, true);
    nb.a_ locala_2 = new nb.a_(this.p, false);
    paramq.a(locala_1, locala_2);
  }
  
  protected void a(q paramq, double[] paramArrayOfDouble)
  {
    int j = f.n;
    a.c.w localw = paramq.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      int i = locale.f();
      this.t[i] = i;
      this.u[i] = i;
      paramArrayOfDouble[i] = 1.7976931348623157E+308D;
      this.x[i] = i;
      this.w[i] = 1.7976931348623157E+308D;
      this.y[i] = false;
      double tmp99_98 = 0.0D;
      this.z[i] = tmp99_98;
      this.A[i] = tmp99_98;
      localw.f();
    } while (j == 0);
  }
  
  public static void a(bb[] paramArrayOfbb, n paramn, x paramx, int[] paramArrayOfInt)
  {
    int i5 = f.o;
    int i4 = f.n;
    int i = paramArrayOfbb.length;
    int j = 2;
    label296:
    label316:
    label325:
    label337:
    label340:
    do
    {
      if (j >= i - 1) {
        break;
      }
      int k = -1;
      int m = 0;
      int n = 0;
      a.c.w localw1 = paramArrayOfbb[j].l();
      a.c.w localw2 = paramArrayOfbb[j].l();
      do
      {
        do
        {
          if (!localw2.e()) {
            break label340;
          }
          e locale1 = localw2.d();
          e locale2 = null;
          int i1 = 0;
          if (i4 != 0) {
            break;
          }
          if (locale1.d() == 1)
          {
            locale2 = locale1.i().e();
            while (paramx.get(locale2) != null) {
              if (i5 == 0) {
                if (paramx.get(locale1) != null) {
                  i1 = 1;
                }
              }
            }
          }
          int i2;
          do
          {
            if (n != paramArrayOfbb[j].size() - 1)
            {
              if (i5 != 0) {
                break label337;
              }
              if (i1 == 0) {
                break label325;
              }
            }
            if (i5 == 0) {}
            i2 = i1 != 0 ? paramArrayOfInt[locale2.f()] : paramArrayOfbb[(j - 1)].size();
            do
            {
              if (m > n) {
                break label316;
              }
              e locale3 = localw1.d();
              if (i4 != 0) {
                break;
              }
              m localm = locale3.m();
              do
              {
                do
                {
                  if (!localm.e()) {
                    break label296;
                  }
                  d locald = localm.a();
                  int i3 = paramArrayOfInt[locald.e().f()];
                  if (i4 != 0) {
                    break;
                  }
                  if (i3 >= k)
                  {
                    if (i5 != 0) {
                      continue;
                    }
                    if (i3 <= i2) {}
                  }
                  else
                  {
                    paramn.a(localm.a(), true);
                  }
                  localm.f();
                } while (i4 == 0);
                localw1.f();
                m++;
              } while (i5 != 0);
            } while (i4 == 0);
          } while (i5 != 0);
          k = i2;
          n++;
          localw2.f();
        } while (i4 == 0);
        j++;
      } while (i5 != 0);
    } while (i4 == 0);
  }
  
  public void b(o paramo, bb[] paramArrayOfbb)
  {
    int i6 = f.o;
    int i5 = f.n;
    int i = 1;
    label15:
    label27:
    label354:
    label366:
    label368:
    label371:
    do
    {
      do
      {
        if (i >= paramArrayOfbb.length) {
          break;
        }
        int j = -1;
        v localv = paramArrayOfbb[i].f();
        do
        {
          if (localv == null) {
            break label371;
          }
          e locale1 = (e)localv.c();
          int k = locale1.f();
          int m = locale1.d();
          if (i5 != 0) {
            break;
          }
          if (m != 0)
          {
            int n = (int)Math.floor((m + 1.0D) / 2.0D);
            int i1 = (int)Math.ceil((m + 1.0D) / 2.0D);
            int i2 = 1;
            d locald = locale1.i();
            do
            {
              do
              {
                if (i2 >= n) {
                  break;
                }
                i2++;
                locald = locald.j();
                if (i6 != 0) {
                  break label368;
                }
                if (i5 != 0) {
                  break label366;
                }
              } while (i5 == 0);
            } while (i6 != 0);
            int i3 = 0;
            do
            {
              if (i2 > i1) {
                break label354;
              }
              if (i6 != 0) {
                break label15;
              }
              if (i5 != 0) {
                break;
              }
              if (i3 != 0) {
                break label354;
              }
              zb localzb = this.l.b(locald);
              e locale2 = locald.e();
              int i4 = locale2.f();
              if (i6 == 0)
              {
                if (this.u[k] == locale1.f())
                {
                  if (i6 != 0) {
                    continue;
                  }
                  if (this.s[locald.d()] == 0)
                  {
                    if (i6 != 0) {
                      continue;
                    }
                    if (j < this.p[i4])
                    {
                      j = this.p[i4];
                      this.u[i4] = locale1.f();
                      this.t[k] = this.t[i4];
                      this.u[k] = this.t[k];
                      i3 = 1;
                      this.A[i4] = localzb.c().a();
                      this.z[k] = localzb.d().a();
                    }
                  }
                }
                locald = locald.j();
                i2++;
              }
            } while (i5 == 0);
          }
          if (i6 != 0) {
            break label27;
          }
          localv = localv.a();
        } while (i5 == 0);
        i++;
      } while (i6 != 0);
    } while (i5 == 0);
  }
  
  protected void a(o paramo, double[] paramArrayOfDouble, bb[] paramArrayOfbb)
  {
    int n = f.o;
    int m = f.n;
    int i = paramArrayOfbb.length - 1;
    Object localObject1;
    Object localObject2;
    int k;
    label106:
    do
    {
      do
      {
        if (i < 0) {
          break;
        }
        localObject1 = paramArrayOfbb[i];
        if (m != 0) {
          break label141;
        }
        localObject2 = ((bb)localObject1).f();
        if (localObject2 != null) {}
        do
        {
          k = ((e)((v)localObject2).c()).f();
          if (m != 0) {
            break label134;
          }
          if (this.t[k] == k)
          {
            if (n != 0) {
              break label106;
            }
            if (paramArrayOfDouble[k] == 1.7976931348623157E+308D) {
              a(k, paramArrayOfDouble);
            }
          }
          localObject2 = ((v)localObject2).a();
          if (m == 0) {
            break;
          }
          i--;
        } while (n != 0);
      } while (m == 0);
    } while (n != 0);
    i = 0;
    label134:
    label141:
    do
    {
      if (i >= paramArrayOfbb.length) {
        break;
      }
      localObject1 = paramArrayOfbb[i].l();
      if (m != 0) {
        break label249;
      }
      if (((a.c.w)localObject1).e())
      {
        localObject2 = paramArrayOfbb[i].l().d();
        k = ((e)localObject2).f();
        if (n != 0) {
          continue;
        }
        if (this.x[this.t[k]] == k)
        {
          if (n != 0) {
            continue;
          }
          if (this.y[k] == 0)
          {
            this.y[k] = true;
            c(k, paramArrayOfDouble);
          }
        }
      }
      i++;
    } while (m == 0);
    label249:
    a.c.w localw = paramo.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      localObject1 = localw.d();
      int j = ((e)localObject1).f();
      double d = this.w[this.x[this.t[j]]];
      if (n == 0)
      {
        if (d < 1.7976931348623157E+308D) {
          paramArrayOfDouble[j] += d;
        }
        localw.f();
      }
    } while (m == 0);
  }
  
  private void a(int paramInt, double[] paramArrayOfDouble)
  {
    int m = f.o;
    int k = f.n;
    ArrayList localArrayList = new ArrayList(50);
    localArrayList.add(new b_(paramInt));
    label167:
    label302:
    label347:
    label510:
    do
    {
      do
      {
        b_ localb_1;
        do
        {
          do
          {
            do
            {
              do
              {
                if (localArrayList.isEmpty()) {
                  return;
                }
                localb_1 = (b_)localArrayList.get(localArrayList.size() - 1);
                if (m != 0) {
                  break label596;
                }
                switch (localb_1.b)
                {
                default: 
                  localArrayList.remove(localArrayList.size() - 1);
                  if (m != 0) {
                    break label167;
                  }
                }
              } while (k == 0);
              paramArrayOfDouble[localb_1.a] = 0.0D;
              localb_1.d = 0.0D;
              localb_1.e = true;
              localb_1.c = localb_1.a;
              localb_1.b = 1;
              if (m == 0) {
                if (localb_1.c != localb_1.a) {
                  localb_1.d -= this.z[localb_1.c];
                }
              }
              if (m == 0)
              {
                if (this.p[localb_1.c] > 0)
                {
                  localb_1.b = 2;
                  if (m != 0) {
                    break label302;
                  }
                  if (k == 0) {
                    break;
                  }
                }
                localb_1.b = 4;
              }
            } while (k == 0);
            localb_1.f = this.q[localb_1.c];
            if (m != 0) {
              break label347;
            }
            localb_1.g = this.t[localb_1.f];
            if (paramArrayOfDouble[localb_1.g] != 1.7976931348623157E+308D) {
              break;
            }
            b_ localb_2 = new b_(localb_1.g);
            localArrayList.add(localb_2);
            if (m != 0) {
              break label347;
            }
            localb_1.b = 3;
          } while (k == 0);
          localb_1.b = 3;
          d1 = localb_1.g;
          int i = localb_1.a;
          int j = localb_1.f;
          if (m == 0) {
            if (this.x[i] == i) {
              this.x[i] = this.x[d1];
            }
          }
          if (this.x[i] == this.x[d1])
          {
            d3 = paramArrayOfDouble[j] + 0.5D * (this.B[j] + this.B[localb_1.c]) + this.C[j] - localb_1.d;
            if (m == 0)
            {
              if (localb_1.e)
              {
                paramArrayOfDouble[i] = d3;
                if (m != 0) {
                  break label513;
                }
                localb_1.e = false;
              }
            }
            else {
              if (k == 0) {
                break label510;
              }
            }
            paramArrayOfDouble[i] = Math.max(paramArrayOfDouble[i], d3);
          }
          localb_1.b = 4;
          localb_1.d += this.A[localb_1.c];
          localb_1.c = this.u[localb_1.c];
          if (m != 0) {
            break label587;
          }
          if (localb_1.c == localb_1.a) {
            break;
          }
          if (m != 0) {
            break label588;
          }
          localb_1.b = 1;
        } while (k == 0);
        localb_1.b = 5;
        double d1 = localb_1.a;
        double d2 = 0.0D;
        double d3 = d1;
        do
        {
          double d4;
          do
          {
            if (d3 != d1) {
              d2 -= this.z[d3];
            }
            paramArrayOfDouble[d1] += d2;
            d2 += this.A[d3];
            d4 = this.u[d3];
          } while (d4 != d1);
          localb_1.b = -1;
          localArrayList.remove(localArrayList.size() - 1);
          if (m != 0) {
            break;
          }
          if (k != 0) {
            break;
          }
        } while (m != 0);
      } while (m != 0);
    } while (k == 0);
    label513:
    label587:
    label588:
    label596:
    return;
  }
  
  private void c(int paramInt, double[] paramArrayOfDouble)
  {
    int i2 = f.o;
    int i1 = f.n;
    ArrayList localArrayList = new ArrayList();
    localArrayList.add(new a_(paramInt));
    label266:
    do
    {
      do
      {
        int n;
        do
        {
          int k;
          do
          {
            int i;
            int j;
            do
            {
              if (localArrayList.size() <= 0) {
                break;
              }
              a_ locala_1 = (a_)localArrayList.get(localArrayList.size() - 1);
              i = locala_1.b;
              j = locala_1.a;
              locala_1.b = this.u[i];
              if (i2 == 0) {
                if (locala_1.b == j) {
                  localArrayList.remove(localArrayList.size() - 1);
                }
              }
              k = this.r[i];
            } while (k < 0);
            int m = this.x[this.t[k]];
            if (i2 != 0) {
              break label266;
            }
            if (m == this.x[j]) {
              break;
            }
            double d = paramArrayOfDouble[k] - paramArrayOfDouble[j] - this.C[i] - 0.5D * (this.B[i] + this.B[k]);
            if (i2 == 0)
            {
              if (this.w[m] != 1.7976931348623157E+308D) {
                d += this.w[m];
              }
              this.w[this.x[j]] = Math.min(this.w[this.x[j]], d);
            }
          } while ((i2 == 0) && (i1 == 0));
          n = this.t[k];
        } while ((i2 == 0) && (this.y[n] != 0));
        this.y[n] = true;
        a_ locala_2 = new a_(n);
        localArrayList.add(locala_2);
      } while (i2 != 0);
    } while (i1 == 0);
  }
  
  protected void a(o paramo)
  {
    int k = f.o;
    int j = f.n;
    double[] arrayOfDouble1 = new double[4];
    double[] arrayOfDouble2 = new double[4];
    a.c.w localw = paramo.v();
    e locale;
    int i;
    do
    {
      if (!localw.e()) {
        break;
      }
      locale = localw.d();
      i = locale.f();
      arrayOfDouble2[0] += this.v[0][i];
      arrayOfDouble2[1] += this.v[1][i];
      arrayOfDouble2[2] += this.v[2][i];
      arrayOfDouble2[3] += this.v[3][i];
      if (k != 0) {
        break label185;
      }
      localw.f();
      if (j != 0) {
        break label181;
      }
    } while (j == 0);
    arrayOfDouble2[0] /= paramo.j();
    arrayOfDouble2[1] /= paramo.j();
    arrayOfDouble2[2] /= paramo.j();
    if (k == 0) {
      arrayOfDouble2[3] /= paramo.j();
    }
    label181:
    label185:
    localw = paramo.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      locale = localw.d();
      i = locale.f();
      a.d.w localw1 = paramo.o(locale);
      arrayOfDouble1[0] = (this.v[0][i] - arrayOfDouble2[0]);
      arrayOfDouble1[1] = (this.v[1][i] - arrayOfDouble2[1]);
      arrayOfDouble1[2] = (this.v[2][i] - arrayOfDouble2[2]);
      arrayOfDouble1[3] = (this.v[3][i] - arrayOfDouble2[3]);
      Arrays.sort(arrayOfDouble1);
      double d = (arrayOfDouble1[1] + arrayOfDouble1[2]) / 2.0D;
      paramo.a(locale, new a.d.w(d, localw1.b()));
      localw.f();
    } while (j == 0);
  }
  
  protected void e()
  {
    super.e();
    this.p = null;
    this.q = null;
    this.B = null;
    this.C = null;
    this.r = null;
    this.s = null;
    this.t = null;
    this.u = null;
    this.v = ((double[][])null);
    this.w = null;
    this.x = null;
    this.y = null;
    this.A = null;
    this.z = null;
  }
  
  private static class a_
  {
    final int a;
    int b;
    
    a_(int paramInt)
    {
      this.a = paramInt;
      this.b = paramInt;
    }
  }
  
  private static final class b_
  {
    final int a;
    byte b;
    int c;
    double d;
    boolean e;
    int f;
    int g;
    
    b_(int paramInt)
    {
      this.a = paramInt;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.d.h

 * JD-Core Version:    0.7.0.1

 */